package org.example.exp2.entity;

import lombok.Getter;
import lombok.Setter;
import org.example.exp2.common.Links;

import java.util.HashMap;
import java.util.Map;

/**
 * @author junchao
 * @version V1.0
 * Copyright (c) 2024, zhoujunchao@csu.edu.com All Rights Reserved.
 * @ProjectName:exp2_mybatis_plus
 * @Title: BorrowRecordVO
 * @Package org.example.exp2.entity
 * @Description:
 * @date 2024/11/25 10:22
 */

@Getter
@Setter
public class BorrowRecordVO {
    private Map<String, String> _links;

    private int Id;
    private int bookId;
    private int personId;
    private String borrowDate;
    private String returnDate;

    public BorrowRecordVO(int recordId, int bookId, int personId, String borrowDate, String returnDate) {
        this.Id = recordId;
        this.bookId = bookId;
        this.personId = personId;
        this.borrowDate = borrowDate;
        this.returnDate = returnDate;
    }

    public void setAllLinks(String baseUri) {
        this._links = new HashMap<>();
        this._links.put("self", baseUri + "/records/" + this.Id);
        this._links.put("book", baseUri + "/books/" + this.bookId);
        this._links.put("person", baseUri + "/persons/" + this.personId);

    }
}